package com.wt.springsamples.ext;

import lombok.Data;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Data
public class Cat implements InitializingBean, DisposableBean ,Animal{

    private String id;
    private  String name;
    private  Integer age;

    public Cat() {
        System.out.println("构造方法");
    }

    public void initMethod(){
        System.out.println("@Bean注解initMethod属性指定的方法");
    }

    public void destroyMethod(){
        System.out.println("@Bean注解destroyMethod属性指定的方法");
    }

//    @PostConstruct
    public void postConstruct(){
        System.out.println("@PostConstruct注解标注的方法");
    }

//    @PreDestroy
    public void preDestroy(){
        System.out.println("@PreDestroy注解标注的方法");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("InitializingBean 接口的 afterPropertiesSet()方法");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("DisposableBean 接口destroy()方法");
    }

    public  void  walk(){
        System.out.println("Dog wal");
    }

    @Override
    public String getType() {
        return "Cat";
    }
}
